set(SOURCES
   VideoSourceV4L2.cpp
   optim.cpp
)

set(HEADERS
   VideoSource.hpp
   VideoSourceV4L2.hpp
   optim.hpp
)

find_package(UEye)

if(UEye_FOUND)
   if(UNIX)
      add_definitions(-D__LINUX__)
   endif(UNIX)
   set(HEADERS ${HEADERS} VideoSourceUEye.hpp)
   set(SOURCES ${SOURCES} VideoSourceUEye.cpp)
   set(LIBS ${LIBS} ${UEye_LIBRARIES})
   option(UEYE "Using UEye library" ON)
endif(UEye_FOUND)

find_package(OpenNI)

if(OpenNI_FOUND)
   set(HEADERS ${HEADERS} VideoSourceKinect.hpp)
   set(SOURCES ${SOURCES} VideoSourceKinect.cpp)
   set(LIBS ${LIBS} ${OpenNI_LIBRARIES} ${GLUT_glut_LIBRARY})
   option(OpenNI "Using OpenNI library" ON)
   include_directories(${OpenNI_INCLUDE_DIRS})
endif(OpenNI_FOUND)

find_package(Boost REQUIRED program_options system serialization filesystem )
find_package(YAML)
if(YAML_FOUND)
   set(HEADERS ${HEADERS} calibratekinect.hpp)
   set(SOURCES ${SOURCES} calibratekinect.cpp)
   set(LIBS ${LIBS} ${YAML_LIBRARIES})
   option(YAML "Using YAML library" ON)
   include_directories(${YAML_INCLUDE_DIRS})
endif(YAML_FOUND)

find_package(FREEGLUT)
if(FREEGLUT_FOUND)
	set(LIBS ${LIBS} ${FREEGLUT_LIBRARIES})
	include_directories(${FREEGLUT_INCLUDE_DIRS})
endif(FREEGLUT_FOUND)

#include_directories(${BTL2_INCLUDE_DIRS})

add_library(BtlExtraVideoSource STATIC ${SOURCES})
set_target_properties(BtlExtraVideoSource PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(BtlExtraVideoSource
   ${LIBS}
   ${BTL2_LIBRARIES}
)
